package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class Ticket extends BaseDomain {

    private String region;//地区

    private String name;//景点名称

    private String pictureImg;//景点图片

    private Double price;//价格

    private String street;//地点

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date creationTime;//创建时间

    //获取json数据
    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("region", region);
        map.put("name", name);
        map.put("pictureImg", pictureImg);
        map.put("price", price);
        map.put("street", street);
        map.put("creationTime", creationTime);
        return JSONUtil.toJSONString(map);
    }

}